/**
 * problem_033.cpp
 * Copyright (C) 2011 - xrose
 */

#include <iostream>
#include <stdio.h>
using namespace std;

int isNontrivial(int ab, int cd)
{
	int b = ab%10;
	int a = (ab -b)/10;
	int d = cd%10;
	int c = (cd -d)/10;

	if(((a!=b)&&(c!=d)&&(a==d)&&(ab*c == cd *b))||((a!=b)&&(c!=d)&&(b==c)&&(ab*d == cd*a)))
	{
        cout<<ab<<"++"<<cd<<endl;
		return 1;
	}
	return 0;
}

int lowestTerm(int *ab, int *cd)
{
//	int _ab = ab;
//	int _cd = cd;
	for(int i=100; i>0; i--)
	{
		if((*ab%i == 0)&&(*cd%i == 0))
		{
			*ab = *ab/i;
			*cd = *cd/i;
		}
	}
}

int main (int argc, char const* argv[])
{
    cout<<isNontrivial(49, 98)<<endl;
	int prodab = 1;
	int prodcd = 1;

	for(int cd = 10;cd<100; cd++)
	{
		for(int ab = 10;ab<cd; ab++)
		{
			if(isNontrivial(ab, cd))
			{
				prodab *= ab;
				prodcd *= cd;
			}
		}
	}
	cout<<prodab<<"__"<<prodcd<<endl;
	lowestTerm(&prodab, &prodcd);
	cout<<prodab<<"__"<<prodcd<<endl;
	return 0;
}
